<style type="text/css">
    .coupon-radio{display: block;}
</style>
<div class="form-group">
    <label class="col-sm-2 control-label">优惠使用限制</label>
    <div class="col-sm-9 col-xs-12" >
        {ife 'sale.coupon' $item}
        <label class="radio-inline coupon-radio">
            <input type="radio" name="limitdiscounttype" value="0" {if $item['limitdiscounttype'] == 0}checked="true"{/if}  /> 不添加优惠使用限制
        </label>
        <label class="radio-inline coupon-radio">
            <input type="radio" name="limitdiscounttype" value="1" {if $item['limitdiscounttype'] == 1}checked="true"{/if}" /> 不允许与促销优惠同时使用
        </label>
        <label class="radio-inline coupon-radio">
            <input type="radio" name="limitdiscounttype" value="2" {if $item['limitdiscounttype'] == 2}checked="true"{/if}  /> 不允许与会员折扣同时使用
        </label>
        <label class="radio-inline coupon-radio">
            <input type="radio" name="limitdiscounttype" value="3" {if $item['limitdiscounttype'] == 3}checked="true"{/if}  /> 不允许与促销优惠和会员折扣同时使用
        </label>
        <span class='help-block'>优惠券是否可以与特定优惠同时使用</span>

        {else} <div class='form-control-static'>
            {if $item['limitdiscounttype']==0}不添加优惠使用限制
            {else if $item['limitdiscounttype']==1}不允许与促销优惠同时使用
            {else if $item['limitdiscounttype']==2}不允许与会员折扣同时使用
            {else if $item['limitdiscounttype']==3}不允许与促销优惠和会员折扣同时使用
            {/if}
        </div>
        {/if}
    </div>
</div>

<div class="form-group">
    <label class="col-sm-2 control-label">商品分类使用限制</label>
    <div class="col-sm-9 col-xs-12" >
          {ife 'sale.coupon' $item}
        <label class="radio-inline coupon-radio">
            <input type="radio" name="limitgoodcatetype" value="0" {if $item['limitgoodcatetype'] == 0}checked="true"{/if}  onclick="$('.selectcats').hide();"/> 不添加商品分类限制
        </label>
        <label class="radio-inline coupon-radio">
            <input type="radio" name="limitgoodcatetype" value="1" {if $item['limitgoodcatetype'] == 1}checked="true"{/if} onclick="$('.selectcats').show();" /> 允许以下商品分类使用
        </label>
        <span class='help-block'>优惠券是否只能用于特定商品或商品类型</span>
		
          {else} <div class='form-control-static'>
                {if $item['limitgoodcatetype']==0}不添加商品分类限制
                {else if $item['limitgoodcatetype']==1}允许以下商品分类使用
                {/if}
          </div>
          {/if}
    </div>
</div>

<div class="form-group selectcats" {if $item['limitgoodcatetype']!=1&&$item['limitgoodcatetype']!=2}style="display:none"{/if}>
    {ife 'sale.coupon' $item}
        <div class="form-group" >
            <label class="col-sm-2 control-label">选择商品分类</label>
            <div class="col-sm-9 col-xs-12">
                <select id="cates"  name='cates[]' class="form-control select2" style='width:605px;' multiple='' >
                    {loop $goodcategorys $c}
                    <option value="{$c['id']}" {if is_array($cates) &&  in_array($c['id'],$cates)}selected{/if} >{$c['name']}</option>
                    {/loop}
                </select>
            </div>
        </div>
    {else}
        <div class='form-control-static ops'>
            {loop $cates $c}
            <a>{$goodcategorys[$c]['name']}</a>
            {/loop}
        </div>
    {/if}

</div>

<div class="form-group">
    <label class="col-sm-2 control-label">商品使用限制</label>
    <div class="col-sm-9 col-xs-12" >
        {ife 'sale.coupon' $item}
        <label class="radio-inline coupon-radio">
            <input type="radio" name="limitgoodtype" value="0" {if $item['limitgoodtype'] == 0}checked="true"{/if} onclick="$('.selectgoods').hide();" /> 不添加商品限制
        </label>
        <label class="radio-inline coupon-radio">
            <input type="radio" name="limitgoodtype" value="1" {if $item['limitgoodtype'] == 1}checked="true"{/if} onclick="$('.selectgoods').show();" /> 允许以下商品使用
        </label>

        {else}
            <div class='form-control-static'>
            {if $item['limitgoodtype']==0}不添加商品限制
                {else if $item['limitgoodtype']==1}允许以下商品使用
            {/if}
        </div>
        {/if}
    </div>
</div>

<div class="form-group selectgoods" {if $item['limitgoodtype']!=1&&$item['limitgoodtype']!=2}style="display:none"{/if}>

    {ife 'sale.coupon' $item}
        <div class="form-group" >
            <label class="col-sm-2 control-label">选择商品</label>
            <div class="col-sm-9 col-xs-12">
                <div class="form-group ">
                    <?php echo tpl_selector('goodsid',array(
                    'preview'=>true,
                    'readonly'=>true,
                    'multi'=>1,
                    'value'=>$item['title'],
                    'url'=>webUrl('sale/coupon/querygoods'),
                    'items'=>$goods,
                    'buttontext'=>'选择商品',
                    'placeholder'=>'请选择商品')
                    )
                    ?>
                </div>
            </div>
        </div>
    {else}
        {if !empty($goods)}
            {loop $goods $item}
                <a href="{php echo tomedia($item['thumb'])}" target='_blank'>
                    <img src="{php echo tomedia($item['thumb'])}" style='width:100px;border:1px solid #ccc;padding:1px' />
                </a>
            {/loop}
        {else}
            暂无商品
        {/if}
    {/if}

</div>









